import { View, Image } from "@tarojs/components";

import React, { FC } from "react";
import styles from "./index.module.scss";
import Taro from "@tarojs/taro";
import imgs from "./imgs/_img";

interface P {
  checked: boolean;
  onChange(v: boolean);
}

export const Checkbox: FC<P> = props => {
  return (
    <View
      className={styles.wrap}
      onClick={() => {
        props.onChange(!props.checked);
      }}
    >
      <Image src={props.checked ? imgs.checked : imgs.off_checked} className={styles.img}></Image>
    </View>
  );
};
